﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using ExtremeSwank.Authentication.OpenID.Persistence;

namespace ExtremeSwank.Authentication.OpenID
{
    /// <summary>
    /// Interface used for Association persistence management objects.
    /// </summary>
    public interface IAssociationPersistence
    {
        /// <summary>
        /// Removes an association entry from persistence.
        /// </summary>
        /// <param name="assoc">The association entry to remove.</param>
        void Remove(Association assoc);
        /// <summary>
        /// Adds an assocation entry to persistence.
        /// </summary>
        /// <param name="association">The Association to store.</param>
        void Add(Association association);
        /// <summary>
        /// Retrieve an association entry by its handle.
        /// </summary>
        /// <param name="handle">The association handle.</param>
        /// <returns>An Association object representing the stored association.</returns>
        Association FindByHandle(string handle);
        /// <summary>
        /// Retrieve an association entry by the OpenID Provider Server URL
        /// </summary>
        /// <param name="server">The server URL.</param>
        /// <returns>An Association object representing the stored association.</returns>
        Association FindByServer(string server);
        /// <summary>
        /// Remove expired association entries from persistence.
        /// </summary>
        void Cleanup();
    }
}
